package com.ruoyi.resturant.service.Impl;
import com.ruoyi.common.exception.BizException;
import com.ruoyi.example.service.impl.StudentServiceImpl;
import com.ruoyi.resturant.domain.ResShop;
import com.ruoyi.resturant.domain.Student;
import com.ruoyi.resturant.mapper.ResShopMapper;
import com.ruoyi.resturant.service.IResShopService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
public class ResShopServiceImpl implements IResShopService {

    private static final Logger log = LoggerFactory.getLogger(ResShopServiceImpl.class);
   @Autowired
    private ResShopMapper resShopMapper;
    @Override
    public ResShop selectResShopById(Long id){
        return resShopMapper.selectResShopById(id);
    }
    @Override
    public List<ResShop> selectResShopByParam(String shopName){
        List<ResShop> resShopLst = resShopMapper.selectResShopByParam(shopName);
        return resShopLst;
    }
    @Override
    public int insertResShop(ResShop resShop){

        return resShopMapper.insertResShop(resShop);
    }
    @Override
    public int updateResShop(ResShop resShop){
        return resShopMapper.updateResShop(resShop);
    }
    @Override
    public int deleteResShopById(Long id){
        ResShop resShop = resShopMapper.selectResShopById(id);
        if(resShop == null) {
            throw new BizException(404, "该店铺ID" + id + "不存在");
        }
        log.info("该店铺ID" + id + "存在");
        return resShopMapper.deleteResShopById(id);
    }
}